//
// MyGame.cpp for bomberman in /home/noboa_y//noboa-y-global/yn
//
// Made by youri noboa
// Login   <noboa_y@epitech.net>
//
// Started on  Fri Apr 20 13:46:10 2012 youri noboa
// Last update Wed Apr 25 18:20:31 2012 youri noboa
//

#include	"MyGame.hh"
#include	"Cube.hh"
#include	"Bomberman.hh"

void		MyGame::initialize(void)
{
  window_.create();
  camera_.initialize();

  objects_.push_back(new Object::Pyramide);
  objects_.push_back(new Object::Cube);
  objects_.push_back(new Model::Bomberman);

  std::list<AObject*>::iterator	itb = this->objects_.begin();
  for (; itb != this->objects_.end(); ++itb)
    (*itb)->initialize();
}

void		MyGame::update(void)
{
  std::list<AObject*>::iterator	itb = this->objects_.begin();
  for (; itb != this->objects_.end(); ++itb)
    (*itb)->update(gameClock_, input_);
  camera_.update(gameClock_, input_);
}

void		MyGame::draw(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glClearColor(0.74f, 0.84f, 95.0f, 1.0f);
  glClearDepth(1.0f);
  std::list<AObject*>::iterator itb = this->objects_.begin();
  for (; itb != this->objects_.end(); ++itb)
    (*itb)->draw();
  this->window_.display();
}

void		MyGame::unload(void)
{
}
